package lueder.servlets;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lueder.classes.SpecialArticles;

/**
 * Servlet implementation class PromotionsServlet
 */
public class PromotionsServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private static String language = "de";
	SpecialArticles articles;
	String path;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public PromotionsServlet() {
		super();
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		articles = new SpecialArticles(8, 0, 5, "ASC", language);
		
		path = request.getContextPath() + "/";

		response.setContentType("text/html");
		PrintWriter out = response.getWriter();

		out.println("<div class='right_box'>");
		out.println("<div class='title'><span class='title_icon'><img src='"
				+ path
				+ "images/bullet4.gif' alt='' title='' /></span>Promotions</div> ");

		out.println(articles.toHtml(path));
		out.println(" </div>");
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
